package com.lovo.service.impl;

import com.lovo.bean.Book;
import com.lovo.dao.BookMapper;
import com.lovo.service.IBookService;
import com.lovo.util.SqlSessionUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class BookServiceImpl implements IBookService {
    @Override
    public List<Book> getBooksByTypeId(int typeId) {
        SqlSession sqlSession = SqlSessionUtil.getSqlSession();
        BookMapper mapper = sqlSession.getMapper(BookMapper.class);
        List<Book> bookList = mapper.getBooksByTypeId(typeId);
        SqlSessionUtil.commit();
        return bookList;

    }
}
